Skip to content

Conversation

@sunyuhan1998
Copy link
Contributor

The original intent of the ToolCallingAutoConfiguration#getClassOrNull method is to attempt loading a specified class, returning null if the class cannot be found. However, the current implementation prints the full stack trace when a ClassNotFoundException is thrown, which may mislead users into thinking there is a real problem (while in fact, this is an expected and normal behavior). This PR improves the exception handling in the method, so that when a ClassNotFoundException occurs, only the class name is logged instead of the entire stack trace, thereby avoiding confusion and improving log clarity.

Fixes #4205
Fixes #4249

…e.ToolCallingAutoConfiguration#getClassOrNull` method to only log the name of the class that failed to load, instead of printing the full stack trace when a `ClassNotFoundException` occurs.

Signed-off-by: Sun Yuhan <[email protected]>
@sobychacko
Copy link
Contributor

Merged via befaf87.

@sobychacko sobychacko closed this Aug 28, 2025
}
catch (ClassNotFoundException e) {
logger.debug("Cannot load class", e);
logger.debug("Cannot load class: {}", className);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This log can still confuse users. Maybe it's better to catch this exception at line 88 and explain why this class is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

3 participants